/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Controller;

import ModelKelas.Login;
import javax.swing.JOptionPane;
import sikompus.AdminForm;

import sikompus.FormApotek;
import sikompus.Pendaftaran;


/**
 *
 * @author valentinus
 */
public class LoginControl {

    public static boolean Otorisasi(String Username, String Password) {
//        String inputUsername = "01";
////        String inputPassword = "Adminvalukabe";
//        String inputPassword = "01";
////        String check;
//        String usrname = Username;
//        String psswd = Password;
//        if (Username.matches("") && psswd.matches("")) {
//            JOptionPane.showMessageDialog(null, "Mohon Mengisikan Username & Password ANDA");
//            return false;
//        }
//        if (!usrname.matches(inputUsername) && !psswd.matches(inputPassword)) {
//            JOptionPane.showMessageDialog(null, "Username & Password Salah");
//            return false;
//        } else if (!usrname.matches(inputUsername)) {
//            JOptionPane.showMessageDialog(null, "Username ANDA Salah");
//            return false;
//        } else if (!psswd.matches(inputPassword)) {
//            JOptionPane.showMessageDialog(null, "Password ANDA Salah");
//            return false;
//        }
//        return true;
//    }
        Login log = new Login();
        log.setNIK(Username);
        log.setPassword(Password);
        if((log.getNIK().equals("01")&& log.getPassword().equals("01"))){
            FormApotek apo = new FormApotek();
            apo.setVisible(true);
        }else if(log.getNIK().equals("02")&&log.getPassword().equals("02") ){
            Pendaftaran pendaf = new Pendaftaran();
            pendaf.setVisible(true);
        }else if(log.getNIK().equals("03")&&log.getPassword().equals("03") ){
            AdminForm admin = new AdminForm();
            admin.setVisible(true);
        }
        return true;
    }

}
